#include "TCPSertest.h"

void TCPServer::send(const std::string& str, ip::tcp::socket& socket)
{
	socket.send(boost::asio::buffer(str));
}

std::string TCPServer::read(ip::tcp::socket& socket) 
{
	std::string buf;
	buf.resize(512);
	std::string buffer;
	boost::system::error_code ec;
	size_t len{ 0 };
	do
	{
		len = socket.read_some(boost::asio::buffer(buf), ec);
		buffer.append(buf.c_str(), len);
	} while (len == buf.size());

	return buffer;
}
